package com.bestcem.xm.award.grpc.service.param.requestaward;

import com.bestcem.xm.award.entity.pojo.AwardRequestDO;
import com.bestcem.xm.award.enums.DeviceTypeEnum;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 * 答题端完成答卷获取奖励
 *
 * @author jie.yao <jie.yao@idiaoyan.com>
 * @version v1.0
 * @date 2021/6/29 13:34
 */
@ToString
@NoArgsConstructor
@Getter
@Setter
public class GetRequestAwardParam {

    /**
     * 答题端ip
     */
    @NotBlank(message = ErrorMessage.REMOTE_IP_NULL_ERROR)
    private String ip;

    /**
     * 投放信息Map
     */
    @NotNull(message = ErrorMessage.DELIVER_NULL_ERROR)
    private Map<String, Object> deliverMap;

    /**
     * 投放信息实体类 数据不全
     */
    private AwardRequestDO.Deliver deliver;

    /**
     * 答卷信息
     */
    @NotNull(message = ErrorMessage.RESPONDENT_NULL_ERROR)
    private AwardRequestDO.Survey survey;

    /**
     * 设备信息 {@link DeviceTypeEnum}
     */
    @NotNull(message = ErrorMessage.TTY_NULL_ERROR)
    @Range(max = 1L, message = ErrorMessage.TTY_STATUS_ERROR)
    private Integer deviceType;

    /**
     * 设备访问次数
     */
    @NotNull(message = ErrorMessage.VT_NULL_ERROR)
    private Integer visitedCount;

    public static class ErrorMessage {
        public static final String REMOTE_IP_NULL_ERROR = "答题端ip不能为空";
        public static final String DELIVER_NULL_ERROR = "投放信息不能为空";
        public static final String RESPONDENT_NULL_ERROR = "答卷信息不能为空";
        public static final String TTY_NULL_ERROR = "设备信息不能为空";
        public static final String TTY_STATUS_ERROR = "设备信息异常";
        public static final String VT_NULL_ERROR = "设备访问次数不能为空";
    }
}
